/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.validation.constraints.Size;

/**
 *
 * @author Samy.A.Omar
 */
@Entity
@Table(name = "TICKET_STATUS")
@NamedQueries({
    @NamedQuery(name = "TicketStatus.findAll", query = "SELECT t FROM TicketStatus t"),
    @NamedQuery(name = "TicketStatus.findByStatusId", query = "SELECT t FROM TicketStatus t WHERE t.statusId = :statusId"),
    @NamedQuery(name = "TicketStatus.findByStatusName", query = "SELECT t FROM TicketStatus t WHERE t.statusName = :statusName")})

public class TicketStatus implements Serializable {
	
	
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    
    
    @Id
    @Column(name = "STATUS_ID")
    @SequenceGenerator(name="TicketStatus_Gen", sequenceName="TICKET_STATUS_SEQ")
    @GeneratedValue(generator="TicketStatus_Gen")
    private Integer statusId;
    
    @Size(max = 20)
    @Column(name = "STATUS_NAME")
    private String statusName;
    
    @OneToMany(mappedBy = "status", fetch = FetchType.LAZY)
    private Collection<Ticket> ticketCollection;
    
    

    public TicketStatus() {
    }



    public Integer getStatusId() {
		return statusId;
	}



	public void setStatusId(Integer statusId) {
		this.statusId = statusId;
	}



	public String getStatusName() {
        return statusName;
    }

    public void setStatusName(String statusName) {
        this.statusName = statusName;
    }

    public Collection<Ticket> getTicketCollection() {
        return ticketCollection;
    }

    public void setTicketCollection(Collection<Ticket> ticketCollection) {
        this.ticketCollection = ticketCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (statusId != null ? statusId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TicketStatus)) {
            return false;
        }
        TicketStatus other = (TicketStatus) object;
        if ((this.statusId == null && other.statusId != null) || (this.statusId != null && !this.statusId.equals(other.statusId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.entities.TicketStatus[ statusId=" + statusId + " ]";
    }
    
}
